
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>动物管理系统</title>
    <meta name="keywords" content="响应式布局、动物管理系统、跨平台、iphone/ipad/mac..." />
    <meta name="author" content="Binpeng Liu Hangzhou Normal University Software enginerring 121" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />


    <!-- basic styles -->

    <link href="../view/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="../view/assets/css/font-awesome.min.css" />

    <!--[if IE 7]>
    <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
    <![endif]-->

    <!-- page specific plugin styles -->

    <!-- fonts -->


    <!-- ace styles -->

    <link rel="stylesheet" href="../view/assets/css/ace.min.css" />
    <link rel="stylesheet" href="../view/assets/css/ace-rtl.min.css" />
    <link rel="stylesheet" href="../view/assets/css/ace-skins.min.css" />

    <!--[if lte IE 8]>
    <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
    <![endif]-->

    <!-- inline styles related to this page -->

    <!-- ace settings handler -->

    <script src="../view/assets/js/ace-extra.min.js"></script>

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

    <!--[if lt IE 9]>
    <script src="assets/js/html5shiv.js"></script>
    <script src="assets/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>




            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row-fluid">
                            <div class="span12">
                                <?php
                                $username=$_REQUEST['username'];
                                $pdo=new PDO('mysql:host=localhost;dbname=db_pet','root','root');
                                $sql="select * from projector where username='{$username}'";
                                $stmt=$pdo->prepare($sql);
                                $stmt->execute();
                                $allrows = $stmt->fetchAll(PDO::FETCH_ASSOC);

                                foreach($allrows as $row){
                                    $pwd=base64_decode($row['password']);
                                    $temp=$row['usertype'];


                                    echo  '<div class="form-group">';
                                    echo '<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="email">用户名:</label>';
                                    echo '<div class="col-xs-12 col-sm-9">';
                                    echo '<div class="clearfix">';
                                    echo '<input type="text" name="username" id="username"  class="col-xs-12 col-sm-6" disabled value="'.$row['username'].'"/>';
                                    echo '</div>';
                                    echo '</div>';
                                    echo '</div>';



                                    echo '<p id="updateResult" class="col-xs-12 col-sm-6"/></p>';

                                    echo '</tr>';
                                }
                                ?>

                                <div class="space-8"></div>
                                <div class="row-fluid wizard-actions">
                                    <button class="btn btn-success btn-next" id="update" data-last="Finish ">
                                        审核通过
                                        <i class="icon-ok icon-on-right"></i>
                                    </button>
                                    <a href="apply.php" class="btn btn-prev" id="disPass">
                                        审核不通过
                                        <i class="icon-remove"></i>
                                    </a>
                                </div>


                            </div><!-- /widget-main -->
                        </div><!-- /widget-body -->
                    </div>
                </div>
            </div>

        </div><!-- /.col -->
    </div><!-- /.row -->
</div><!-- /.page-content -->
</div><!-- /.main-content -->
            </body>
<script>

    document.getElementById("update").onclick = function() {
        var request = new XMLHttpRequest();
        request.open("POST", "../controller/update.php");
        var data = "username=" +document.getElementById("username").value;
        alert(data);
        request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        request.send(data);
        request.onreadystatechange = function() {
            if (request.readyState===4) {
                if (request.status===200) {
                    document.getElementById("updateResult").innerHTML = request.responseText;

                } else {
                    alert("发生错误：" + request.status);
                }
            }
        }
    }


    document.getElementById("disPass").onclick = function() {
        alert("你已拒绝该申请");
    }
</script>

